import { useStorage } from '@vueuse/core';

// token
const TokenKey = 'Admin-Token';
const tokenStorage = useStorage<null | string>(TokenKey, null);
export const getToken = () => tokenStorage.value;
export const setToken = (access_token?: string) =>
    (tokenStorage.value = access_token);
export const removeToken = () => (tokenStorage.value = null);
// token

// refresh_token
const RefreshTokenKey = 'Refresh-Token';
const refreshTokenStorage = useStorage<null | string>(RefreshTokenKey, null);
export const getRefreshToken = () => refreshTokenStorage.value;
export const setRefreshToken = (refresh_token?: string) =>
    (refreshTokenStorage.value = refresh_token);
export const removeRefreshToken = () => (refreshTokenStorage.value = null);
// refresh_token
